class Category < ActiveRecord::Base

  validates_uniqueness_of :name

  before_save :filter_comma

  def filter_comma
    self.tags = self.tags.to_s.gsub(/，/,',')
  end

  # attached start
  has_attached_file :cover
  validates_attachment_content_type :cover, :content_type => /\Aimage/
  validates_attachment :cover, :size => { :in => 0..10.kilobytes }

end
